<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/9/27
 * Time: 18:27
 */
try
{
    $pdo = new PDO("mysql:host=127.0.0.1;dbname=test0925","root","");
    $pdo->exec("SET NAMES 'utf8'");
}
catch (Exception $e)
{
    var_dump($e);
    die("连接失败");
}

$selectSQL  = "select * from zkw_user order by id desc";
$res = $pdo->query($selectSQL);

?>

<link rel="stylesheet" href="http://cdn.amazeui.org/amazeui/2.7.2/css/amazeui.css">
<div class="header">
    <div class="am-g">
        <h1 style="text-align: center">数据表</h1>
    </div>
    <hr />
</div>
<table class="am-table am-table-bordered am-table-radius am-table-striped">
    <thead>
    <tr>
        <th>编号</th>
        <th>姓名</th>
        <th>年龄</th>
        <th>电话</th>
        <th>学号</th>
        <th>性别</th>
    </tr>
    </thead>

    <tbody>

    <?php
    foreach ($res as $row){
        ?>

        <tr>
            <td><?php echo $row['id']?></td>
            <td><?php echo $row['name']?></td>
            <td><?php echo $row['age']?></td>
            <td><?php echo $row['tel']?></td>
            <td><?php echo $row['no']?></td>
            <td><?php echo $row['sex']?></td>
            <td><a href="editTable.php?id=<?php echo $row['id']?>">修改</a></td>
            <td><a href="delete.php?id=<?php echo $row['id']?>">删除</a></td>
        </tr>

    <?php } ?>

    </tbody>
</table>


